package xrz.com.jr;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import xrz.com.jr.entity.PersionEntry;
import xrz.com.jr.utils.ExitUtil;
import xrz.com.jr.utils.PhoneUtil;
import xrz.com.jr.utils.SharedPreferencesUtils;

public class PersionActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView Tv_UserName;
    private TextView Tv_Phone;
    private TextView Tv_DeviceId;
    private TextView Tv_Time;
    private TextView Tv_Title;
    private ImageView Img_Back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_persion);
        init();
        ExitUtil.getInstant().addToPool(this);
    }

    private void init() {
        initView();
    }

    private void initView() {
        Tv_UserName = (TextView) findViewById(R.id.tv_username);
        Tv_Phone = (TextView) findViewById(R.id.tv_phone);
        Tv_DeviceId = (TextView) findViewById(R.id.tv_deviceid);
        Tv_Time = (TextView) findViewById(R.id.tv_time);
        Tv_Title = (TextView) findViewById(R.id.top_title);
        Img_Back = (ImageView) findViewById(R.id.top_back_);
        PersionEntry entry = (PersionEntry) SharedPreferencesUtils.readObject(this, "persion");
        Tv_UserName.setText(entry.getUsername());
        Tv_Phone.setText(entry.getPhone());
        Tv_DeviceId.setText(PhoneUtil.GetDeviceId(this));
        Tv_Time.setText(entry.getTime());
        Img_Back.setOnClickListener(this);
        Tv_Title.setText("用户信息");
    }

    @Override
    public void onClick(View view) {
        finish();
    }
}
